

# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the USB input drivers
#

usbhid-y	:= hid-core.o
usbhid-y	+= hiddev.o
usbhid-y	+= hid-pidff.o

obj-m		+= usbhid.o
obj-m		+= usbkbd.o
obj-m		+= usbmouse.o



PWD := $(shell pwd)

ifeq ($(ARCH),)
ARCH := $(shell uname -m)
endif
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE :=
endif
ifeq ($(KDIR),)
KDIR := /lib/modules/$(shell uname -r)/build
ifeq ($(ARCH),i686)
ifeq ($(wildcard $KDIR/arch/$ARCH),)
ARCH=i386
endif
endif
endif

default:
	$(MAKE) ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} -C $(KDIR) M=$(PWD) modules
	rm -rf *~ .tmp_versions modules.order Module.symvers .cache.mk
	find . -type f -name "*~" -o -name "*.o"  -o -name "*.cmd"   -o -name "*.mod"   -o -name "*.mod.c" |  xargs rm -rf

clean:
	rm -rf *~ .tmp_versions modules.order Module.symvers .cache.mk
	find . -type f -name "*~" -o -name "*.o" -o -name "*.ko" -o -name "*.cmd"  -o -name  "*.o.d"   -o -name "*.mod.c" |  xargs rm -rf
